package org.yx.service.sres.view_group_info;

import org.dbist.dml.Page;
import org.dbist.dml.Query;
import org.yx.models.SResGrpDef;
import org.yx.utils.BaseService;

import com.xiaoleilu.hutool.util.StrUtil;

/**
 * 查询设备资源组列表
 * 
 * @author zxw
 * @since 2022/04/13
 **/
public class SresViewGroupInfoService extends BaseService {
	public SresViewGroupInfoOut viewGroupInfo(SresViewGroupInfoIn in) throws Exception {
		Query query = new Query(in.getPageIndex(), in.getPageSize());
		query.addFilter("groupStatus", "N");
		if (StrUtil.isNotBlank(in.getGroupCode())) {
			query.addFilter("groupCode", in.getGroupCode());
		}
		query.addOrder("groupCode", true);

		Page<SResGrpDef> groupPage = selectPage(SResGrpDef.class, query);

		SresViewGroupInfoOut out = new SresViewGroupInfoOut();
		out.setGroupList(groupPage.getList());
		out.setTotal(groupPage.getTotalSize());

		return out;
	}
}